<template>
    <div>
        Home（
        <a v-if="isLogin == 'ok'" href="#" @click="outLogin">退出登录</a>
        <a v-else href="#" @click="$router.push('/Login')">前往登录</a>
        ）
    </div>
</template>

<script setup>
import { ref } from 'vue';
import { useRouter } from 'vue-router';
const isLogin = ref(window.localStorage.getItem('login'));
const router = useRouter();

const outLogin = () => {
    window.localStorage.removeItem('login');
    router.push('/Login');
}
</script>
